import { defineStore } from 'pinia'
//定义store
export const userStore = defineStore('userStore', {
  state: () => {
    return {
      userId: '',
      menuList: [],
      codeList: []
    }
  },
  actions: {
    setUserId(userId: string) {
      this.userId = userId;
    },
    setMenu(menu: any) {
      this.menuList = menu;
    },
    setCode(code: any) {
      this.codeList = code;
    },
  },
  persist: {
    storage: localStorage,
    pick: ['userId', 'menuList', 'codeList']
  }
})